package com.jt.feign;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

//此对象
@Component
public class ProviderFallbackFactory implements
        FallbackFactory<RemoteProviderSevice> {
    //当远程调用的服务不可用时,系统可以调用此方法进行请求处理
    @Override
    public RemoteProviderSevice create(Throwable throwable) {
        return new RemoteProviderSevice() {
            @Override
            public String echoMsg(String msg) {
                return "服务维护中";
            }
        };
    }
}
